# 引入模块
from common.base import Base, create_browser_op


# 创建类
class PageGotoModule(Base):
    # 定义属性
    url = "http://localhost:8080/ecshop"
    aa= ("xpath", "//a[@href='category.php?id=16']")
    bb = "xpath", "//img[@src='images/201605/thumb_img/48_thumb_G_1462852915482.jpg']"
    cc = "div[class='path']>div"

    # 定义方法
    # 打开网页
    def page_goto_module_open_web(self):
        self.base_open_web(self.url)

    # 点击服装
    def page_goto_module_click(self):
        self.base_click(self.aa)

    # 点击商品
    def page_goto_module_goods_click(self):
        self.base_click(self.bb)

    # 获取当前位置文本
    def page_goto_module_get_text(self):
        return self.base_get_text1(self.cc)

    # 退出
    def page_goto_module_quit(self):
        self.base_quit()

    # 查看源代码
    def page_goto_module_get_attribute(self):
        result = self.base_get_attribute(self.cc)
        return result


if __name__ == '__main__':
    pg1 = PageGotoModule(create_browser_op(r'C:\Users\86184\AppData\Local\Google\Chrome\User Data'))
    pg1.page_goto_module_open_web()
    print(pg1.page_goto_module_get_attribute())
    pg1.page_goto_module_quit()